package com.project.game;
import java.awt.Graphics;
import java.awt.Image;
import java.awt.Point;
import java.awt.Rectangle;
import java.awt.event.KeyEvent;

import javax.swing.JPanel;
import javax.swing.text.Position;


public class Player {
	private Image image;
	private Point movement; // 움직임
	private Point position; // 위치
	private JPanel scene;
	private boolean remove; // 제거
	private Rectangle collisionArea; // 충돌영역
	
	private final int x = 350; // 지구 x위치
	private final int y = 250; // 지구의 y위치
	
	
	public Point getPosition() {
		return position;
	}

	public void setPosition(Point position) {
		this.position = position;
	}
	
	public Player(JPanel scene, Image image) {
		super();
		this.scene = scene;
		this.image = image;
		position = new Point();
		movement = new Point();
		collisionArea = new Rectangle();
		collisionArea.width = (int)(image.getWidth(null)*0.8);
		collisionArea.height = (int)(image.getHeight(null)*0.8);
	}
	
	public Rectangle getCollisionArea(){
		collisionArea.x = position.x + (image.getWidth(null) - collisionArea.width) / 2;
		collisionArea.y = position.y + (image.getHeight(null) - collisionArea.height) / 2;
		return collisionArea;
	}

	public void update() { // 매 프레임마다 호출된 데이터 변경 메서드

	}
	
	public void render(Graphics g){ // 매 프레임마다 호출될 그리기 메서드
		if(image != null){
		g.drawImage(image, x, y, null);
		}
	}
	
	
	
//	public void keyPressed(KeyEvent e) {
//		switch (e.getKeyCode()){
//
//		}
//	}
//	
//	public void keyReleased(KeyEvent e) {
//		switch(e.getKeyCode()) {
//		
//		}
//
//	}


}
